Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m1n1.adt: introduce yet another DAPFT8110 variant #345

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

alyssais
Copy link
Contributor

@alyssais alyssais commented Oct 27, 2023

When I tried to use the proxyclient shell, I got:
"Exception parsing /device-tree/arm-io/dart-dcp.dapf-instance-0 value […]"

I laid out the hex dump in a text editor, and added line breaks every 56 bytes (the former size of DAPFT8110B):

0000703b020000000080713b0200000020000000000000000000000000000000000000000000000000000000000000000003010000000000
40723b020000000080723b020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000
003b020000007f73073b02000000200000000000000000000000000000000000000000000000000000000000000000030100000000000028
3d020000000040283d020000002000000000000000000000000000000000000000000000000000000000000000000301000000000080003d
020000000380003d020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000e03f02
000000ffffef3f0200000020000000000000000000000000000000000000000000000000000000000000000003010000000000c0403e0200
0000ffff403e020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000433e020000
00ff3f433e020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000783d02000000
03417a3d0200000020000000000000000000000000000000000000000000000000000000000000000003010000000000003c3b0200000000
003e3b020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000403c02000000ffff
473c020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000103c020000004f0c10
3c020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000703d020000000341723d
02000000200000000000000000000000000000000000000000000000000000000000000000030100000000

Looking at the patterns shared by all struct instances (r0h = 3, r0l = 1, for example), each row appeared to be shifted one byte to the left compared to its predecessor. This suggests that DAPFT8110B has only three extra bytes of padding compared to DAPFT8110.

Removing the one byte of unknown data in the DAPFT8110B fixed the problem, allowing me to start the shell.

This seems to be how the device I have works, anyway. I'm not able to test others.

@@ -228,7 +228,6 @@
"unk3" / Hex(Int8ul),
"r0h" / Hex(Int8ul),
"r0l" / Hex(Int8ul),
"unk4" / Hex(Int8ul),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This depends unfortunately on the iboot version. Depending on the version we need variants with either 3 or 4 bytes of additional unknown data (maybe padding).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, so what's the proper fix here, then? Figure out what iBoot version changed it, and check that in the parser?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add this as additional variant and decide based on the length which one to use. The length of the property has to be a multiple of the element length and based on the size and typical number of elements I think we're not going to run into ambiguous situations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

src/adt.c Outdated Show resolved Hide resolved
@alyssais alyssais force-pushed the adt branch 2 times, most recently from 1faa7e9 to 801e5f2 Compare October 28, 2023 20:40
When I tried to use the proxyclient shell, I got:
"Exception parsing /device-tree/arm-io/dart-dcp.dapf-instance-0 value […]"

I laid out the hex dump in a text editor, and added line breaks every
56 bytes (the former size of DAPFT8110B):

0000703b020000000080713b0200000020000000000000000000000000000000000000000000000000000000000000000003010000000000
40723b020000000080723b020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000
003b020000007f73073b02000000200000000000000000000000000000000000000000000000000000000000000000030100000000000028
3d020000000040283d020000002000000000000000000000000000000000000000000000000000000000000000000301000000000080003d
020000000380003d020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000e03f02
000000ffffef3f0200000020000000000000000000000000000000000000000000000000000000000000000003010000000000c0403e0200
0000ffff403e020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000433e020000
00ff3f433e020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000783d02000000
03417a3d0200000020000000000000000000000000000000000000000000000000000000000000000003010000000000003c3b0200000000
003e3b020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000403c02000000ffff
473c020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000103c020000004f0c10
3c020000002000000000000000000000000000000000000000000000000000000000000000000301000000000000703d020000000341723d
02000000200000000000000000000000000000000000000000000000000000000000000000030100000000

Looking at the patterns shared by all struct instances
(r0h = 3, r0l = 1, for example), each row appeared to be shifted one
byte to the left compared to its predecessor.  This suggests that
DAPFT8110B has only three extra bytes of padding compared to
DAPFT8110.

So, here I introduce DAPFT8110C, a new variant, one byte shorter than
DAPFT8110B.  Unlike DAPFT8110, there's no flag to differentiate
between these two variants, so we just have to guess based on what
divisor makes whole structs.

Signed-off-by: Alyssa Ross <[email protected]>
@alyssais alyssais changed the title m1n1.adt: fix padding in DAPFT8110B definition @alyssais m1n1.adt: introduce yet another DAPFT8110 variant Oct 28, 2023
@alyssais alyssais changed the title @alyssais m1n1.adt: introduce yet another DAPFT8110 variant m1n1.adt: introduce yet another DAPFT8110 variant Oct 28, 2023
@marcan marcan merged commit 93cce40 into AsahiLinux:main Nov 14, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants